{__NOLAYOUT__}
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="__ROOT__/static/admin/lib/html5shiv.js"></script>
<script type="text/javascript" src="__ROOT__/static/admin/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="__ROOT__/static/admin/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="__ROOT__/static/admin/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="__ROOT__/static/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="__ROOT__/static/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="__ROOT__/static/admin/static/h-ui.admin/css/style.css" />
<link rel="stylesheet" href="__ROOT__/static/admin/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<link href="__ROOT__/static/admin/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="__ROOT__/static/admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>产品分类</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 产品管理 <span class="c-gray en">&gt;</span> 产品分类 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<table class="table">
	<tr>
		<td width="300" class="va-t">
			<ul id="l_50">
			<?php foreach ($c_data as $row) { ?>
				<li value="<?php echo $row['color']; ?>"><b class='Hui-iconfont yellow'>&#xe6ff;</b><span><?php echo $row['id']; ?>.</span><?php echo $row['color']; ?></li>
			<?php } ?>	
			</ul>
		</td>
		<td class="va-t">
			<div>
				<td>内存参数管理</td>
			</div>
			<div>
				<input id="w_200" type="text" placeholder="填写颜色" class="input-text radius size-M">
				<input id="button" class="btn btn-success radius" type="button" value="添加">

			</div>
		</td>
	</tr>
	
</table>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__ROOT__/static/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="__ROOT__/static/admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__ROOT__/static/admin/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="__ROOT__/static/admin/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript" src="__ROOT__/static/admin/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js">
</script> 
<script type="text/javascript">
	$("#button").click(function() {
		color = $("#w_200").val();
		$.ajax({
			url:"{:url('admin/product/product_color_add')}",
			type:'post',
			dataType:'json',
			data:{color:color},
			success:function( ret ){
				if( ret.error == '0' ){
		          	layer.alert(ret.msg,{icon:6},function(){
		            location.reload();
		        });
		        }else{
		          	layer.alert(ret.msg,{icon:3});
		        }
			},
			error:function(){
				layer.alert('System error');
			}
		})
	})
	// 删除/编辑
	$("#l_50 li").hover(function() {
			$(this).append("<i id='edit' class='Hui-iconfont' title='编辑'>&#xe6df;</i><i id='del' class='Hui-iconfont' title='删除' style='margin-left:10px'>&#xe60b;</i>");
			that = $(this);
			//删除分类
			$("#del").click(function(event) {
				layer.confirm('确认删除该分类?',function(){
					var cname = that.attr('value');
					$.ajax({
						url: "{:url('admin/product/color_del')}",
						type: 'post',
						dataType: 'json',
						async:false,
						data:{cname:cname},
						success:function( ret ){
							if( ret.error == '0'){
								layer.alert('删除成功',{icon: 6});
									that.remove();
							}else{
								layer.alert('删除失败',{icon: 3});
							}
						}
					});
				});
			});
			$("#edit").click(function(){
				var cname = that.attr('value');
				layer_show("修改分类名称","{:url('admin/product/color_edit_show')}?cname="+cname,300,200);
			});
		}, function() {
			$("#l_50 li i").remove();
		});
</script>
</body>
</html>